/*
 * @Author: your name
 * @Date: 2021-08-12 09:07:53
 * @LastEditTime: 2021-11-29 08:03:59
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \li-yuwei\demo-work\src\router\index.js
 */
import Vue from "vue";
import VueRouter from "vue-router";
// const User = {
//     template: "<div>User</div>",
// };
const originalPush = VueRouter.prototype.push;

VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch((err) => err);
};
Vue.use(VueRouter);

const routes = [{
        path: "/",
        name: "Home",
        component: () =>
            import ("../view/Home.vue"),
        children: [{
            path: "/classify/:value",
            name: "Classify",
            component: () =>
                import ("../view/classify/index.vue"),
        }, ],
    },
    {
        path: "/archived",
        name: "Archived",
        component: () =>
            import ("../view/Archived.vue"),
    },
    {
        path: "/knowledge",
        name: "Knowledge",
        component: () =>
            import ("../view/Knowledge.vue"),
    },
    {
        path: "/article/:id",
        name: "ArticleDetail",
        component: () =>
            import ("../view/articleDetail/index.vue"),
    },
    {
        path: "/page/:path",
        name: "Page",
        component: () =>
            import ("../view/page/index.vue"),
    },
    {
        path: "/tag/:value",
        name: "Tag",
        component: () =>
            import ("../view/tag/index.vue"),
    },
];

const router = new VueRouter({
    mode: "history",
    base: process.env.BASE_URL,
    routes,
});

export default router;